local skel = fk.CreateSkill {
  name = "#lb__jizhuo-choose",
}

Fk:loadTranslationTable {
  ["#lb__jizhuo-choose"] = "济浊",
}

skel:addEffect("active", {
  expand_pile = function (self, player)
    return self.extra_data.ids
  end,
  card_filter = function(self, player, to_select, selected, selected_targets)
    if #selected < 2 and table.contains(self.extra_data.ids, to_select) then
      if #selected == 1 then
        return Fk:getCardById(to_select).number + Fk:getCardById(selected[1]).number == 14
      end
      return true
    end
  end,
  target_filter = function(self, player, to_select, selected, selected_cards, _, extra_data)
    if #selected_cards == 2 and #selected == 0 and player:distanceTo(to_select) <= 1 then
      local card = Fk:cloneCard("peach")
      card:addSubcards(selected_cards)
      card.skillName = skel.name
      return player:canUseTo(card, to_select)
    end
  end,
  feasible = function(self, player, selected, selected_cards, card)
    return #selected == 1 and #selected_cards == 2
  end,
})

return skel
